package statemachines;


//Juste pour voir si ça marche, ne pas faire attention à ce package.

public abstract class State {
	private String name;
	private StateMachine parentMachine;
	
	public State(String name) {
		this.name = name;
		parentMachine = null;
	}
	
	public State(String name, StateMachine parentMachine) {
		this.name = name;
		setParentStateMachine(parentMachine);
	}
	
	public void setParentStateMachine(StateMachine parentMachine) {
		this.parentMachine = parentMachine;
	}
	
	public String getName() {
		return name;
	}
	
	public void playNextStep() {
		doAction();
		checkNextStep();
	}
	
	public void goTo(String stateName) {
		parentMachine.goTo(stateName);
	}
	
	public abstract void doAction();
	public abstract void checkNextStep();
}
